package pyx.crazycards.server.core;

import javaactor.library.core.Message;
import javaactor.library.core.Process;
import javaactor.library.core.Registry;
import javaactor.library.core.annotations.Actor;
import javaactor.library.core.exception.JavaActorException;
import pyx.crazycards.server.messages.AuthenticationMsg;

@Actor(name="Router")
public class RouterActor extends Process{

	@Override
	public void react(Message message) throws JavaActorException {
		
		if(message.getName().equals("Authenticate")) {

			AuthenticationMsg auth = (AuthenticationMsg) message;			
			Registry.send(AuthenticatorActor.class, message);
			
		} else if(message.getName().equals("LoadUserCards")) {
			
			Registry.send(ReplyRemoteActor.class, message);
		} else if(message.getName().equals("Play")) {
			
			send(GameLogicActor.class, message);
		}
	}

}
